package com.cryrabbit.yyystitp.adapters;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by CryRabbit on 2016/9/3.
 */

public class ViewPagerAdapter extends FragmentPagerAdapter{
    private List<Fragment> fragments=new ArrayList<>();
    private List<String> titles=new ArrayList<>();
    public ViewPagerAdapter(FragmentManager fragmentManager,List<Fragment> fragments,List<String> titles){
        super(fragmentManager);
        this.fragments=fragments;
        this.titles=titles;
    }
    @Override
    public int getCount() {
        return fragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles.get(position);
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }
}
